Frequentist GGM
setwd("/Users/ywxiu/Library/CloudStorage/OneDrive-UvA/thesis/R")
library(bootnet)
library(dplyr)
library(EGAnet)
library(qgraph)
# Import data
#dataset is shared on OSF: data.csv
Data <- read.csv2("data.csv",header=T)
Data <- filter(Data, sample == "fr"| sample == "en")
DataFrench <- filter(Data, sample == "fr")
Data <- select(DataFrench, SBPS1, SBPS2, SBPS3, SBPS4, SBPS5, SBPS6, SBPS7, SBPS8,CEIII1E, CEIII2C, CEIII3E, CEIII4C, CEIII5E, CEIII6C, CEIII7E, CEIII8C, CEIII9E, CEIII10C)
n1 <- EGA(data = Data, model = "glasso", plot.EGA=TRUE)

print(n1)
## Model: GLASSO (EBIC with gamma = 0.5)
## Correlations: auto
## Lambda: 0.0689424853967522 (n = 100, ratio = 0.1)
##
## Number of nodes: 18
## Number of edges: 80
## Edge density: 0.523
##
## Non-zero edge weights:
## M SD Min Max
## 0.090 0.094 -0.089 0.340
##
## ----
##
## Algorithm: Walktrap
##
## Number of communities: 2
##
## SBPS1 SBPS2 SBPS3 SBPS4 SBPS5 SBPS6 SBPS7 SBPS8
## 1 1 1 1 1 1 1 1
## CEIII1E CEIII2C CEIII3E CEIII4C CEIII5E CEIII6C CEIII7E CEIII8C
## 2 2 2 2 2 2 2 2
## CEIII9E CEIII10C
## 2 2
##
## ----
##
## Unidimensional Method: Louvain
## Unidimensional: No
##
## ----
##
## TEFI: -14.322
boot.n1 <- bootEGA(data = Data, iter = 1000, typicalStructure = TRUE,
plot.typicalStructure = TRUE, model = "glasso", plot.type = "qgraph",
type = "parametric", ncores = 2, seed = 1000)

# item and dimension stability
itemStability(boot.n1)

## EGA Type: EGA
## Bootstrap Samples: 1000 (Parametric)
##
## Proportion Replicated in Dimensions:
##
## SBPS1 SBPS2 SBPS3 SBPS4 SBPS5 SBPS6 SBPS7 SBPS8
## 1.000 1.000 1.000 1.000 1.000 1.000 1.000 0.921
## CEIII1E CEIII2C CEIII3E CEIII4C CEIII5E CEIII6C CEIII7E CEIII8C
## 0.997 0.967 0.997 0.992 0.997 0.944 1.000 0.968
## CEIII9E CEIII10C
## 0.997 0.971
dimensionStability(boot.n1)

## EGA Type: EGA
## Bootstrap Samples: 1000 (Parametric)
##
## Proportion Replicated in Dimensions:
##
## SBPS1 SBPS2 SBPS3 SBPS4 SBPS5 SBPS6 SBPS7 SBPS8
## 1.000 1.000 1.000 1.000 1.000 1.000 1.000 0.921
## CEIII1E CEIII2C CEIII3E CEIII4C CEIII5E CEIII6C CEIII7E CEIII8C
## 0.997 0.967 0.997 0.992 0.997 0.944 1.000 0.968
## CEIII9E CEIII10C
## 0.997 0.971
##
## ----
##
## Structural Consistency:
##
## 1 2
## 0.942 0.941
EGA.fit(
data = Data,
n = NULL,
uni.method = c("expand", "LE"),
corr = c("cor_auto", "pearson", "spearman"),
model = c("glasso", "TMFG"),
steps = c(3, 4, 5, 6, 7, 8)
)

## Model: GLASSO (EBIC with gamma = 0.5)
## Correlations: auto
## Lambda: 0.0689424853967522 (n = 100, ratio = 0.1)
##
## Number of nodes: 18
## Number of edges: 80
## Edge density: 0.523
##
## Non-zero edge weights:
## M SD Min Max
## 0.090 0.094 -0.089 0.340
##
## ----
##
## Algorithm: Walktrap (Steps = 3)
##
## Number of communities: 2
##
## SBPS1 SBPS2 SBPS3 SBPS4 SBPS5 SBPS6 SBPS7 SBPS8
## 1 1 1 1 1 1 1 1
## CEIII1E CEIII2C CEIII3E CEIII4C CEIII5E CEIII6C CEIII7E CEIII8C
## 2 2 2 2 2 2 2 2
## CEIII9E CEIII10C
## 2 2
##
##
## ----
##
## TEFI: -14.322
gr<-list('Boredom'=c(1:8),'Curiosity'=c(10,12,14,16,18),'Exploration'= c(9,11,13,15,17))
n1<-estimateNetwork(Data, default= "EBICglasso")
plot(n1, layout = "spring", groups=gr,
layoutScale = c(1,1), palette = "colorblind",
theme = "TeamFortress", vsize = 8,legend.cex=0.5)

Bayesian MRF
#Set Working Directory
setwd("/Users/ywxiu/Library/CloudStorage/OneDrive-UvA/thesis/R")
#Load the necessary packages
library(easybgm)
## Registered S3 methods overwritten by 'ergm':
## method from
## simulate.formula lme4
## simulate.formula_lhs lme4
## summary.formula Hmisc
## Registered S3 methods overwritten by 'BFpack':
## method from
## get_estimates.lm bain
## get_estimates.t_test bain
library(bgms)
library(dplyr)
#import data
Data <- read.csv2("data.csv",header=T)
Data <- Data[c(1:490),c(6:13,15:24)]
data <- as.matrix(Data)
#Model fit with easybgm
MRF_fit <- easybgm::easybgm(data = data,
type = "ordinal",
package = "bgms",
interaction_prior="UnitInfo",
edge_prior= "Bernoulli",
iter = 1e5,
save = TRUE,
centrality = TRUE)
MRF_fit0 <- easybgm::easybgm(data = data,
type = "ordinal",
package = "bgms",
interaction_prior="UnitInfo",
edge_prior= "Bernoulli",
iter = 1e5,
save = FALSE,
centrality = TRUE)
#summary output
summary(MRF_fit)
##
## BAYESIAN ANALYSIS OF NETWORKS
## Model type: ordinal
## Number of nodes: 18
## Fitting Package: bgms
## ---
## EDGE SPECIFIC OVERVIEW
## Relation Estimate Posterior Incl. Prob. Inclusion BF Category
## SBPS1-SBPS2 0.133 1.000 Inf included
## SBPS1-SBPS3 0.016 0.371 0.591 inconclusive
## SBPS2-SBPS3 0.052 0.874 6.959 inconclusive
## SBPS1-SBPS4 0.004 0.137 0.159 inconclusive
## SBPS2-SBPS4 0.001 0.066 0.071 excluded
## SBPS3-SBPS4 0.005 0.179 0.218 inconclusive
## SBPS1-SBPS5 0.110 1.000 Inf included
## SBPS2-SBPS5 0.002 0.089 0.098 excluded
## SBPS3-SBPS5 0.129 1.000 Inf included
## SBPS4-SBPS5 0.042 0.765 3.254 inconclusive
## SBPS1-SBPS6 0.116 1.000 2499.000 included
## SBPS2-SBPS6 0.202 1.000 Inf included
## SBPS3-SBPS6 0.007 0.178 0.216 inconclusive
## SBPS4-SBPS6 0.175 1.000 Inf included
## SBPS5-SBPS6 0.091 0.982 54.066 included
## SBPS1-SBPS7 0.188 1.000 Inf included
## SBPS2-SBPS7 0.002 0.078 0.085 excluded
## SBPS3-SBPS7 0.004 0.139 0.161 inconclusive
## SBPS4-SBPS7 0.134 1.000 Inf included
## SBPS5-SBPS7 0.102 1.000 Inf included
## SBPS6-SBPS7 0.046 0.690 2.222 inconclusive
## SBPS1-SBPS8 -0.001 0.058 0.062 excluded
## SBPS2-SBPS8 0.006 0.166 0.199 inconclusive
## SBPS3-SBPS8 0.070 0.997 309.559 included
## SBPS4-SBPS8 0.098 1.000 Inf included
## SBPS5-SBPS8 0.001 0.049 0.051 excluded
## SBPS6-SBPS8 0.086 0.994 161.866 included
## SBPS7-SBPS8 -0.001 0.051 0.053 excluded
## SBPS1-CEIII1E 0.000 0.037 0.039 excluded
## SBPS2-CEIII1E -0.053 0.781 3.561 inconclusive
## SBPS3-CEIII1E 0.001 0.058 0.061 excluded
## SBPS4-CEIII1E 0.000 0.044 0.046 excluded
## SBPS5-CEIII1E 0.000 0.045 0.047 excluded
## SBPS6-CEIII1E 0.000 0.044 0.046 excluded
## SBPS7-CEIII1E -0.029 0.509 1.038 inconclusive
## SBPS8-CEIII1E -0.001 0.049 0.052 excluded
## SBPS1-CEIII2C -0.002 0.085 0.093 excluded
## SBPS2-CEIII2C -0.017 0.371 0.591 inconclusive
## SBPS3-CEIII2C -0.049 0.894 8.406 inconclusive
## SBPS4-CEIII2C 0.002 0.088 0.096 excluded
## SBPS5-CEIII2C 0.001 0.066 0.071 excluded
## SBPS6-CEIII2C -0.016 0.324 0.480 inconclusive
## SBPS7-CEIII2C 0.002 0.072 0.077 excluded
## SBPS8-CEIII2C 0.070 0.980 49.787 included
## CEIII1E-CEIII2C -0.079 0.974 37.971 included
## SBPS1-CEIII3E -0.033 0.595 1.470 inconclusive
## SBPS2-CEIII3E 0.003 0.093 0.102 inconclusive
## SBPS3-CEIII3E -0.002 0.102 0.113 inconclusive
## SBPS4-CEIII3E 0.009 0.242 0.319 inconclusive
## SBPS5-CEIII3E -0.002 0.085 0.093 excluded
## SBPS6-CEIII3E -0.001 0.048 0.051 excluded
## SBPS7-CEIII3E -0.001 0.060 0.064 excluded
## SBPS8-CEIII3E 0.002 0.077 0.084 excluded
## CEIII1E-CEIII3E 0.168 1.000 Inf included
## CEIII2C-CEIII3E 0.072 0.972 34.261 included
## SBPS1-CEIII4C 0.001 0.047 0.049 excluded
## SBPS2-CEIII4C 0.000 0.040 0.042 excluded
## SBPS3-CEIII4C 0.000 0.041 0.043 excluded
## SBPS4-CEIII4C -0.001 0.047 0.049 excluded
## SBPS5-CEIII4C -0.001 0.051 0.053 excluded
## SBPS6-CEIII4C -0.010 0.208 0.263 inconclusive
## SBPS7-CEIII4C -0.001 0.052 0.055 excluded
## SBPS8-CEIII4C 0.033 0.568 1.315 inconclusive
## CEIII1E-CEIII4C 0.090 0.985 66.659 included
## CEIII2C-CEIII4C 0.009 0.215 0.274 inconclusive
## CEIII3E-CEIII4C 0.000 0.042 0.044 excluded
## SBPS1-CEIII5E -0.079 0.938 15.116 included
## SBPS2-CEIII5E -0.019 0.347 0.530 inconclusive
## SBPS3-CEIII5E 0.000 0.045 0.047 excluded
## SBPS4-CEIII5E 0.000 0.044 0.045 excluded
## SBPS5-CEIII5E -0.043 0.676 2.082 inconclusive
## SBPS6-CEIII5E -0.056 0.711 2.462 inconclusive
## SBPS7-CEIII5E -0.030 0.506 1.025 inconclusive
## SBPS8-CEIII5E -0.052 0.809 4.248 inconclusive
## CEIII1E-CEIII5E 0.093 0.996 226.790 included
## CEIII2C-CEIII5E 0.000 0.042 0.044 excluded
## CEIII3E-CEIII5E 0.108 1.000 Inf included
## CEIII4C-CEIII5E 0.005 0.127 0.145 inconclusive
## SBPS1-CEIII6C 0.000 0.034 0.036 excluded
## SBPS2-CEIII6C 0.000 0.040 0.041 excluded
## SBPS3-CEIII6C -0.001 0.059 0.062 excluded
## SBPS4-CEIII6C 0.001 0.060 0.064 excluded
## SBPS5-CEIII6C 0.000 0.042 0.044 excluded
## SBPS6-CEIII6C -0.001 0.055 0.058 excluded
## SBPS7-CEIII6C 0.000 0.038 0.039 excluded
## SBPS8-CEIII6C 0.115 1.000 Inf included
## CEIII1E-CEIII6C 0.001 0.066 0.071 excluded
## CEIII2C-CEIII6C 0.095 1.000 Inf included
## CEIII3E-CEIII6C 0.009 0.269 0.369 inconclusive
## CEIII4C-CEIII6C 0.021 0.467 0.877 inconclusive
## CEIII5E-CEIII6C 0.000 0.042 0.044 excluded
## SBPS1-CEIII7E 0.023 0.416 0.712 inconclusive
## SBPS2-CEIII7E -0.003 0.086 0.094 excluded
## SBPS3-CEIII7E -0.001 0.068 0.073 excluded
## SBPS4-CEIII7E 0.002 0.077 0.084 excluded
## SBPS5-CEIII7E -0.001 0.048 0.050 excluded
## SBPS6-CEIII7E 0.002 0.067 0.072 excluded
## SBPS7-CEIII7E -0.059 0.878 7.227 inconclusive
## SBPS8-CEIII7E 0.000 0.040 0.042 excluded
## CEIII1E-CEIII7E 0.009 0.201 0.252 inconclusive
## CEIII2C-CEIII7E 0.088 1.000 2039.816 included
## CEIII3E-CEIII7E 0.001 0.058 0.062 excluded
## CEIII4C-CEIII7E 0.165 1.000 Inf included
## CEIII5E-CEIII7E 0.043 0.682 2.148 inconclusive
## CEIII6C-CEIII7E 0.083 1.000 Inf included
## SBPS1-CEIII8C 0.001 0.060 0.064 excluded
## SBPS2-CEIII8C -0.004 0.114 0.129 inconclusive
## SBPS3-CEIII8C -0.004 0.140 0.162 inconclusive
## SBPS4-CEIII8C 0.001 0.058 0.062 excluded
## SBPS5-CEIII8C -0.029 0.580 1.382 inconclusive
## SBPS6-CEIII8C 0.000 0.039 0.040 excluded
## SBPS7-CEIII8C 0.001 0.047 0.050 excluded
## SBPS8-CEIII8C 0.003 0.096 0.106 inconclusive
## CEIII1E-CEIII8C 0.038 0.665 1.987 inconclusive
## CEIII2C-CEIII8C 0.149 1.000 Inf included
## CEIII3E-CEIII8C 0.092 1.000 Inf included
## CEIII4C-CEIII8C 0.091 0.998 631.911 included
## CEIII5E-CEIII8C 0.001 0.064 0.068 excluded
## CEIII6C-CEIII8C 0.062 0.991 115.686 included
## CEIII7E-CEIII8C 0.001 0.059 0.062 excluded
## SBPS1-CEIII9E -0.051 0.727 2.663 inconclusive
## SBPS2-CEIII9E -0.003 0.086 0.094 excluded
## SBPS3-CEIII9E -0.012 0.306 0.440 inconclusive
## SBPS4-CEIII9E 0.003 0.100 0.111 inconclusive
## SBPS5-CEIII9E -0.002 0.073 0.078 excluded
## SBPS6-CEIII9E -0.027 0.407 0.688 inconclusive
## SBPS7-CEIII9E -0.005 0.136 0.157 inconclusive
## SBPS8-CEIII9E -0.004 0.114 0.128 inconclusive
## CEIII1E-CEIII9E 0.084 0.981 51.715 included
## CEIII2C-CEIII9E 0.001 0.052 0.054 excluded
## CEIII3E-CEIII9E 0.006 0.157 0.186 inconclusive
## CEIII4C-CEIII9E 0.085 0.985 64.274 included
## CEIII5E-CEIII9E 0.099 0.993 133.048 included
## CEIII6C-CEIII9E -0.079 1.000 Inf included
## CEIII7E-CEIII9E 0.253 1.000 Inf included
## CEIII8C-CEIII9E 0.001 0.043 0.045 excluded
## SBPS1-CEIII10C -0.001 0.051 0.054 excluded
## SBPS2-CEIII10C -0.003 0.097 0.108 inconclusive
## SBPS3-CEIII10C -0.001 0.049 0.051 excluded
## SBPS4-CEIII10C -0.005 0.165 0.197 inconclusive
## SBPS5-CEIII10C -0.007 0.191 0.236 inconclusive
## SBPS6-CEIII10C 0.000 0.039 0.040 excluded
## SBPS7-CEIII10C -0.001 0.062 0.066 excluded
## SBPS8-CEIII10C -0.003 0.117 0.133 inconclusive
## CEIII1E-CEIII10C -0.015 0.345 0.526 inconclusive
## CEIII2C-CEIII10C 0.100 1.000 Inf included
## CEIII3E-CEIII10C -0.002 0.075 0.081 excluded
## CEIII4C-CEIII10C 0.093 1.000 Inf included
## CEIII5E-CEIII10C 0.112 1.000 Inf included
## CEIII6C-CEIII10C 0.000 0.041 0.043 excluded
## CEIII7E-CEIII10C 0.000 0.043 0.045 excluded
## CEIII8C-CEIII10C 0.073 0.993 142.062 included
## CEIII9E-CEIII10C -0.001 0.054 0.057 excluded
##
## Bayes Factors larger than 10 were considered sufficient evidence for the classification
## ---
## AGGREGATED EDGE OVERVIEW
## Number of edges with sufficient evidence for inclusion: 39
## Number of edges with insufficient evidence: 50
## Number of edges with sufficient evidence for exclusion: 64
## Number of possible edges: 153
##
## ---
## STRUCTURE OVERVIEW
## Number of visited structures: 99604
## Number of possible structures: 1.141798e+46
## Posterior probability of most likely structure: 3e-05
## ---
#Summary method for easybgm objects
summary(MRF_fit, evidence_thresh = 10)
##
## BAYESIAN ANALYSIS OF NETWORKS
## Model type: ordinal
## Number of nodes: 18
## Fitting Package: bgms
## ---
## EDGE SPECIFIC OVERVIEW
## Relation Estimate Posterior Incl. Prob. Inclusion BF Category
## SBPS1-SBPS2 0.133 1.000 Inf included
## SBPS1-SBPS3 0.016 0.371 0.591 inconclusive
## SBPS2-SBPS3 0.052 0.874 6.959 inconclusive
## SBPS1-SBPS4 0.004 0.137 0.159 inconclusive
## SBPS2-SBPS4 0.001 0.066 0.071 excluded
## SBPS3-SBPS4 0.005 0.179 0.218 inconclusive
## SBPS1-SBPS5 0.110 1.000 Inf included
## SBPS2-SBPS5 0.002 0.089 0.098 excluded
## SBPS3-SBPS5 0.129 1.000 Inf included
## SBPS4-SBPS5 0.042 0.765 3.254 inconclusive
## SBPS1-SBPS6 0.116 1.000 2499.000 included
## SBPS2-SBPS6 0.202 1.000 Inf included
## SBPS3-SBPS6 0.007 0.178 0.216 inconclusive
## SBPS4-SBPS6 0.175 1.000 Inf included
## SBPS5-SBPS6 0.091 0.982 54.066 included
## SBPS1-SBPS7 0.188 1.000 Inf included
## SBPS2-SBPS7 0.002 0.078 0.085 excluded
## SBPS3-SBPS7 0.004 0.139 0.161 inconclusive
## SBPS4-SBPS7 0.134 1.000 Inf included
## SBPS5-SBPS7 0.102 1.000 Inf included
## SBPS6-SBPS7 0.046 0.690 2.222 inconclusive
## SBPS1-SBPS8 -0.001 0.058 0.062 excluded
## SBPS2-SBPS8 0.006 0.166 0.199 inconclusive
## SBPS3-SBPS8 0.070 0.997 309.559 included
## SBPS4-SBPS8 0.098 1.000 Inf included
## SBPS5-SBPS8 0.001 0.049 0.051 excluded
## SBPS6-SBPS8 0.086 0.994 161.866 included
## SBPS7-SBPS8 -0.001 0.051 0.053 excluded
## SBPS1-CEIII1E 0.000 0.037 0.039 excluded
## SBPS2-CEIII1E -0.053 0.781 3.561 inconclusive
## SBPS3-CEIII1E 0.001 0.058 0.061 excluded
## SBPS4-CEIII1E 0.000 0.044 0.046 excluded
## SBPS5-CEIII1E 0.000 0.045 0.047 excluded
## SBPS6-CEIII1E 0.000 0.044 0.046 excluded
## SBPS7-CEIII1E -0.029 0.509 1.038 inconclusive
## SBPS8-CEIII1E -0.001 0.049 0.052 excluded
## SBPS1-CEIII2C -0.002 0.085 0.093 excluded
## SBPS2-CEIII2C -0.017 0.371 0.591 inconclusive
## SBPS3-CEIII2C -0.049 0.894 8.406 inconclusive
## SBPS4-CEIII2C 0.002 0.088 0.096 excluded
## SBPS5-CEIII2C 0.001 0.066 0.071 excluded
## SBPS6-CEIII2C -0.016 0.324 0.480 inconclusive
## SBPS7-CEIII2C 0.002 0.072 0.077 excluded
## SBPS8-CEIII2C 0.070 0.980 49.787 included
## CEIII1E-CEIII2C -0.079 0.974 37.971 included
## SBPS1-CEIII3E -0.033 0.595 1.470 inconclusive
## SBPS2-CEIII3E 0.003 0.093 0.102 inconclusive
## SBPS3-CEIII3E -0.002 0.102 0.113 inconclusive
## SBPS4-CEIII3E 0.009 0.242 0.319 inconclusive
## SBPS5-CEIII3E -0.002 0.085 0.093 excluded
## SBPS6-CEIII3E -0.001 0.048 0.051 excluded
## SBPS7-CEIII3E -0.001 0.060 0.064 excluded
## SBPS8-CEIII3E 0.002 0.077 0.084 excluded
## CEIII1E-CEIII3E 0.168 1.000 Inf included
## CEIII2C-CEIII3E 0.072 0.972 34.261 included
## SBPS1-CEIII4C 0.001 0.047 0.049 excluded
## SBPS2-CEIII4C 0.000 0.040 0.042 excluded
## SBPS3-CEIII4C 0.000 0.041 0.043 excluded
## SBPS4-CEIII4C -0.001 0.047 0.049 excluded
## SBPS5-CEIII4C -0.001 0.051 0.053 excluded
## SBPS6-CEIII4C -0.010 0.208 0.263 inconclusive
## SBPS7-CEIII4C -0.001 0.052 0.055 excluded
## SBPS8-CEIII4C 0.033 0.568 1.315 inconclusive
## CEIII1E-CEIII4C 0.090 0.985 66.659 included
## CEIII2C-CEIII4C 0.009 0.215 0.274 inconclusive
## CEIII3E-CEIII4C 0.000 0.042 0.044 excluded
## SBPS1-CEIII5E -0.079 0.938 15.116 included
## SBPS2-CEIII5E -0.019 0.347 0.530 inconclusive
## SBPS3-CEIII5E 0.000 0.045 0.047 excluded
## SBPS4-CEIII5E 0.000 0.044 0.045 excluded
## SBPS5-CEIII5E -0.043 0.676 2.082 inconclusive
## SBPS6-CEIII5E -0.056 0.711 2.462 inconclusive
## SBPS7-CEIII5E -0.030 0.506 1.025 inconclusive
## SBPS8-CEIII5E -0.052 0.809 4.248 inconclusive
## CEIII1E-CEIII5E 0.093 0.996 226.790 included
## CEIII2C-CEIII5E 0.000 0.042 0.044 excluded
## CEIII3E-CEIII5E 0.108 1.000 Inf included
## CEIII4C-CEIII5E 0.005 0.127 0.145 inconclusive
## SBPS1-CEIII6C 0.000 0.034 0.036 excluded
## SBPS2-CEIII6C 0.000 0.040 0.041 excluded
## SBPS3-CEIII6C -0.001 0.059 0.062 excluded
## SBPS4-CEIII6C 0.001 0.060 0.064 excluded
## SBPS5-CEIII6C 0.000 0.042 0.044 excluded
## SBPS6-CEIII6C -0.001 0.055 0.058 excluded
## SBPS7-CEIII6C 0.000 0.038 0.039 excluded
## SBPS8-CEIII6C 0.115 1.000 Inf included
## CEIII1E-CEIII6C 0.001 0.066 0.071 excluded
## CEIII2C-CEIII6C 0.095 1.000 Inf included
## CEIII3E-CEIII6C 0.009 0.269 0.369 inconclusive
## CEIII4C-CEIII6C 0.021 0.467 0.877 inconclusive
## CEIII5E-CEIII6C 0.000 0.042 0.044 excluded
## SBPS1-CEIII7E 0.023 0.416 0.712 inconclusive
## SBPS2-CEIII7E -0.003 0.086 0.094 excluded
## SBPS3-CEIII7E -0.001 0.068 0.073 excluded
## SBPS4-CEIII7E 0.002 0.077 0.084 excluded
## SBPS5-CEIII7E -0.001 0.048 0.050 excluded
## SBPS6-CEIII7E 0.002 0.067 0.072 excluded
## SBPS7-CEIII7E -0.059 0.878 7.227 inconclusive
## SBPS8-CEIII7E 0.000 0.040 0.042 excluded
## CEIII1E-CEIII7E 0.009 0.201 0.252 inconclusive
## CEIII2C-CEIII7E 0.088 1.000 2039.816 included
## CEIII3E-CEIII7E 0.001 0.058 0.062 excluded
## CEIII4C-CEIII7E 0.165 1.000 Inf included
## CEIII5E-CEIII7E 0.043 0.682 2.148 inconclusive
## CEIII6C-CEIII7E 0.083 1.000 Inf included
## SBPS1-CEIII8C 0.001 0.060 0.064 excluded
## SBPS2-CEIII8C -0.004 0.114 0.129 inconclusive
## SBPS3-CEIII8C -0.004 0.140 0.162 inconclusive
## SBPS4-CEIII8C 0.001 0.058 0.062 excluded
## SBPS5-CEIII8C -0.029 0.580 1.382 inconclusive
## SBPS6-CEIII8C 0.000 0.039 0.040 excluded
## SBPS7-CEIII8C 0.001 0.047 0.050 excluded
## SBPS8-CEIII8C 0.003 0.096 0.106 inconclusive
## CEIII1E-CEIII8C 0.038 0.665 1.987 inconclusive
## CEIII2C-CEIII8C 0.149 1.000 Inf included
## CEIII3E-CEIII8C 0.092 1.000 Inf included
## CEIII4C-CEIII8C 0.091 0.998 631.911 included
## CEIII5E-CEIII8C 0.001 0.064 0.068 excluded
## CEIII6C-CEIII8C 0.062 0.991 115.686 included
## CEIII7E-CEIII8C 0.001 0.059 0.062 excluded
## SBPS1-CEIII9E -0.051 0.727 2.663 inconclusive
## SBPS2-CEIII9E -0.003 0.086 0.094 excluded
## SBPS3-CEIII9E -0.012 0.306 0.440 inconclusive
## SBPS4-CEIII9E 0.003 0.100 0.111 inconclusive
## SBPS5-CEIII9E -0.002 0.073 0.078 excluded
## SBPS6-CEIII9E -0.027 0.407 0.688 inconclusive
## SBPS7-CEIII9E -0.005 0.136 0.157 inconclusive
## SBPS8-CEIII9E -0.004 0.114 0.128 inconclusive
## CEIII1E-CEIII9E 0.084 0.981 51.715 included
## CEIII2C-CEIII9E 0.001 0.052 0.054 excluded
## CEIII3E-CEIII9E 0.006 0.157 0.186 inconclusive
## CEIII4C-CEIII9E 0.085 0.985 64.274 included
## CEIII5E-CEIII9E 0.099 0.993 133.048 included
## CEIII6C-CEIII9E -0.079 1.000 Inf included
## CEIII7E-CEIII9E 0.253 1.000 Inf included
## CEIII8C-CEIII9E 0.001 0.043 0.045 excluded
## SBPS1-CEIII10C -0.001 0.051 0.054 excluded
## SBPS2-CEIII10C -0.003 0.097 0.108 inconclusive
## SBPS3-CEIII10C -0.001 0.049 0.051 excluded
## SBPS4-CEIII10C -0.005 0.165 0.197 inconclusive
## SBPS5-CEIII10C -0.007 0.191 0.236 inconclusive
## SBPS6-CEIII10C 0.000 0.039 0.040 excluded
## SBPS7-CEIII10C -0.001 0.062 0.066 excluded
## SBPS8-CEIII10C -0.003 0.117 0.133 inconclusive
## CEIII1E-CEIII10C -0.015 0.345 0.526 inconclusive
## CEIII2C-CEIII10C 0.100 1.000 Inf included
## CEIII3E-CEIII10C -0.002 0.075 0.081 excluded
## CEIII4C-CEIII10C 0.093 1.000 Inf included
## CEIII5E-CEIII10C 0.112 1.000 Inf included
## CEIII6C-CEIII10C 0.000 0.041 0.043 excluded
## CEIII7E-CEIII10C 0.000 0.043 0.045 excluded
## CEIII8C-CEIII10C 0.073 0.993 142.062 included
## CEIII9E-CEIII10C -0.001 0.054 0.057 excluded
##
## Bayes Factors larger than 10 were considered sufficient evidence for the classification
## ---
## AGGREGATED EDGE OVERVIEW
## Number of edges with sufficient evidence for inclusion: 39
## Number of edges with insufficient evidence: 50
## Number of edges with sufficient evidence for exclusion: 64
## Number of possible edges: 153
##
## ---
## STRUCTURE OVERVIEW
## Number of visited structures: 99604
## Number of possible structures: 1.141798e+46
## Posterior probability of most likely structure: 3e-05
## ---
# =========================
# DATA VISUALISATION
# =========================
# 0. Plot posterior structure estimates
# 0.a Posterior structure probability
#Plot Posterior Structure Probabilities
easybgm::plot_structure_probabilities(MRF_fit)

# 0.b. Posterior complexity probability
easybgm::plot_complexity_probabilities(MRF_fit)

complexity <- c()
for(i in 1:length(MRF_fit$sample_graph)){
complexity[i] <- sum(as.numeric(unlist(strsplit(MRF_fit$sample_graph[i], ""))))
}
data_complexity <- cbind(complexity, MRF_fit$graph_weights) %>%
as_tibble() %>%
group_by(complexity) %>%
summarise(complexity_weight = sum(V2))
## Warning: The `x` argument of `as_tibble.matrix()` must have unique column names if
## `.name_repair` is omitted as of tibble 2.0.0.
## ℹ Using compatibility `.name_repair`.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
data_complexity$complexity
## [1] 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
## [26] 75
data_complexity$complexity_weight
## [1] 8 24 99 331 773 1743 3151 5338 7552 10122 11920 12780
## [13] 11965 10510 8270 6141 4011 2373 1474 777 356 178 63 23
## [25] 16 2
# 1. Plot structure
#generate 3 groups in plot
generate_sequence <- function() {
sequence <- character(0)
for (i in 1:10) {
if (i %% 2 == 0) {
sequence <- c(sequence, "Curiosity")
} else {
sequence <- c(sequence, "Exploration")
}
}
return(sequence)
}
result <- generate_sequence()
Groups <- c(rep("Boredom Proneness", 8), result)
easybgm::plot_structure(MRF_fit, layoutScale = c(.8,1), palette = "colorblind",legend = F, groups = Groups,
theme = "TeamFortress", vsize = 6, edge.width = .3, layout = "spring")

# 2. Plot network model (also referred to as median probability model)
# set two plots with the same layout.
Layout <- qgraph::averageLayout(n1)
easybgm::plot_network(MRF_fit, layout = Layout, groups=Groups,legend=F,
layoutScale = c(1,1), palette = "colorblind",
theme = "TeamFortress", vsize = 8,evidence_thresh = 10,dashed = TRUE)

# 3. Plot evidence plot
easybgm::plot_edgeevidence(MRF_fit, split = T,edge.width = 2,evidence_thresh = 10,groups=Groups,legend=F,palette = "colorblind",layout=Layout)


## [[1]]
## From To Weight
## 1 --- 2 1
## 2 --- 3 1
## 1 --- 5 1
## 3 --- 5 1
## 4 --- 5 1
## 1 --- 6 1
## 2 --- 6 1
## 4 --- 6 1
## 5 --- 6 1
## 1 --- 7 1
## 4 --- 7 1
## 5 --- 7 1
## 6 --- 7 1
## 3 --- 8 1
## 4 --- 8 1
## 6 --- 8 1
## 2 --- 9 1
## 7 --- 9 1
## 3 --- 10 1
## 8 --- 10 1
## 9 --- 10 1
## 1 --- 11 1
## 9 --- 11 1
## 10 --- 11 1
## 8 --- 12 1
## 9 --- 12 1
## 1 --- 13 1
## 5 --- 13 1
## 6 --- 13 1
## 7 --- 13 1
## 8 --- 13 1
## 9 --- 13 1
## 11 --- 13 1
## 8 --- 14 1
## 10 --- 14 1
## 7 --- 15 1
## 10 --- 15 1
## 12 --- 15 1
## 13 --- 15 1
## 14 --- 15 1
## 5 --- 16 1
## 9 --- 16 1
## 10 --- 16 1
## 11 --- 16 1
## 12 --- 16 1
## 14 --- 16 1
## 1 --- 17 1
## 9 --- 17 1
## 12 --- 17 1
## 13 --- 17 1
## 14 --- 17 1
## 15 --- 17 1
## 10 --- 18 1
## 12 --- 18 1
## 13 --- 18 1
## 16 --- 18 1
##
## [[2]]
## From To Weight
## 1 --- 3 1
## 1 --- 4 1
## 2 --- 4 1
## 3 --- 4 1
## 2 --- 5 1
## 3 --- 6 1
## 2 --- 7 1
## 3 --- 7 1
## 1 --- 8 1
## 2 --- 8 1
## 5 --- 8 1
## 7 --- 8 1
## 1 --- 9 1
## 3 --- 9 1
## 4 --- 9 1
## 5 --- 9 1
## 6 --- 9 1
## 8 --- 9 1
## 1 --- 10 1
## 2 --- 10 1
## 4 --- 10 1
## 5 --- 10 1
## 6 --- 10 1
## 7 --- 10 1
## 2 --- 11 1
## 3 --- 11 1
## 4 --- 11 1
## 5 --- 11 1
## 6 --- 11 1
## 7 --- 11 1
## 8 --- 11 1
## 1 --- 12 1
## 2 --- 12 1
## 3 --- 12 1
## 4 --- 12 1
## 5 --- 12 1
## 6 --- 12 1
## 7 --- 12 1
## 10 --- 12 1
## 11 --- 12 1
## 2 --- 13 1
## 3 --- 13 1
## 4 --- 13 1
## 10 --- 13 1
## 12 --- 13 1
## 1 --- 14 1
## 2 --- 14 1
## 3 --- 14 1
## 4 --- 14 1
## 5 --- 14 1
## 6 --- 14 1
## 7 --- 14 1
## 9 --- 14 1
## 11 --- 14 1
## 12 --- 14 1
## 13 --- 14 1
## 1 --- 15 1
## 2 --- 15 1
## 3 --- 15 1
## 4 --- 15 1
## 5 --- 15 1
## 6 --- 15 1
## 8 --- 15 1
## 9 --- 15 1
## 11 --- 15 1
## 1 --- 16 1
## 2 --- 16 1
## 3 --- 16 1
## 4 --- 16 1
## 6 --- 16 1
## 7 --- 16 1
## 8 --- 16 1
## 13 --- 16 1
## 15 --- 16 1
## 2 --- 17 1
## 3 --- 17 1
## 4 --- 17 1
## 5 --- 17 1
## 6 --- 17 1
## 7 --- 17 1
## 8 --- 17 1
## 10 --- 17 1
## 11 --- 17 1
## 16 --- 17 1
## 1 --- 18 1
## 2 --- 18 1
## 3 --- 18 1
## 4 --- 18 1
## 5 --- 18 1
## 6 --- 18 1
## 7 --- 18 1
## 8 --- 18 1
## 9 --- 18 1
## 11 --- 18 1
## 14 --- 18 1
## 15 --- 18 1
## 17 --- 18 1
# 4. Plot parameter forest plot
easybgm::plot_parameterHDI(MRF_fit)

# 5. Plot strength centrality estimate and 95% highest density interval
easybgm::plot_centrality(MRF_fit)
